package com.myway.dto.util;

import java.math.BigDecimal;

public class BigDecimalUtils {

    //计算两个数相除。
    public static double  getDivideAmount(double amount,double amount1){
        BigDecimal decimal = new BigDecimal(amount/amount1);
        return decimal.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue();
    }
    //两个数相乘
    public static double  getTimeAmount(double amount,double amount1){
        BigDecimal decimal = new BigDecimal(amount*amount1);
        return decimal.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue();
    }

    public static double  getAddAmount(double amount){
        BigDecimal decimal = new BigDecimal(amount);
        return decimal.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue();
    }

    public static double  getFloatAmount(float amount){
        BigDecimal decimal = new BigDecimal(amount);
        return decimal.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue();
    }

}
